local game = require "club.threecard.bjracing"
local blaze = require "blaze"

local Poker_gamescene = blaze.class(game.pokerlib.Poker)

local log = game.logging.get("Poker")

function Poker_gamescene:ctor()
    self.res = "club.threecard.bjracing/models/common.b:poker" 
end

function Poker_gamescene:Select()
    self:WillSelect(false);
    if self.selected then
        self:Unselect();
    else
        self.selected = true;
        self.select_flag2:SetActive(true);
    end
end

function Poker_gamescene:Unselect()
    self:WillSelect(false);
    self.selected = false;
    self.select_flag2:SetActive(false);
end

function Poker_gamescene:Flip(pokerData, callback, timeLength)
    timeLength = timeLength or 0.5;
    self.transform:DOScaleX(0, timeLength/2)
    :OnComplete(function()
        self:set_data(pokerData);
        self.transform:DOScaleX(1, timeLength/2)
        :OnComplete(function()
            callback();
         end)
    end)
end

return Poker_gamescene